Ramya Shankar | 30 Mar, 2023

TCS Interview Questions and Answers in 2024 | Recruitment Process


TCS is a great place to start as well as grow your career. It offers a friendly and positive ambiance for both individual and company growth. With operations in about 46 countries, TCS recruits a large pool of candidates and the main qualities they look for in a candidate are the aptitude and the attitude.

The process

If you are a fresher, you will have to pass through 3 rounds of interviews – sometimes 4. There will be a written test (aptitude test), group discussion, technical interview and an HR round. TCS also opts in for phone interview for screening purposes.

Are you from CS, IT or MCA background? Then you will be asked questions on C, C++, OOPS, SDLC and perhaps Java. If not, you will be asked questions about your final year project and the technical knowledge you acquired during college days. They will ask you if you are comfortable with any programming language (maybe C or OOPS) and ask you a few basic questions. Be prepared to write at least recursion, factorial, LCM, GCD, swapping numbers and palindrome programs apart from the list of questions we have below.

Though they do prefer candidates with 75% or above, if you have a minimum score of 65% with no arrears, you can apply for the interview.

If you are hopping from another company, you will have one or two rounds of technical interview followed by HR discussion. There may be more than one interviewer and you will be asked questions on various topics from your resume.

Technical Interview Tips

While aptitude (written test) and group discussion somewhat depend on luck too, the technical and HR rounds are totally in your control. TCS interview questions are thorough and test you on your concepts as well as coding ability. It is important to be well prepared and do some coding practice before going for the written test/interview.

TCS Interview Questions

Here are some common questions asked in the technical round of TCS interview. Note that not all questions are from a single interview. This list is a collection of TCS Interview questions from different interviews.

Which is your favorite or strongest programming language?

Rather than favorite, mention the language you will be most comfortable with because they will ask you more questions on the language you mention. It can be C, C++, Java, SQL or anything of your choice.

Question: What do you know about SDLC?

Answer: Software Development Life Cycle (SDLC) describes the entire process of application development from its requirements analysis to maintenance. There are 5 stages – requirement analysis, design, development, testing & deployment, and support or maintenance.

Question: Are you familiar with the various SDLC methodologies?

Answer: There are 6 models –

  • Waterfall model (most common and traditional) – a sequential phase by phase approach, for example, after the requirements phase, the design phase is taken up and then the next and so on.
  • V-shaped – Same as the waterfall, but there is a testing phase after each development phase.
  • Iterative – A quick way to build the basic product. Even when complete requirements are not known, you can start development. The process is repeated to improve and accommodate more requirements.
  • Spiral – Similar to iterative but allows for more refinement as the project goes through all the stages in a spiral until it is complete.
  • Big bang – The development starts with minimal knowledge of requirement, thus requires little planning. It is suitable only for small projects that involve less risk.
  • Agile – Currently, the most preferred method, the project is delivered in phases, and the customers, developers, testers and onsite coordinators work in tandem. Each new release is like a continuous development over every previous release.

Check here the Top SDLC Methodologies

Question-Related to HTML

Question: What is metadata? What is its purpose?

Answer: Metadata stores information about the data that the HTML document stores. This is done using thetag. Metadata can store information like keywords, page description, last modified date and can be used by browsers, web services, and search engines.

Question: Write a simple HTML to get the username as input and submit the value entered.

Answer:

Username:
 

You can explain the main tags like

, and the action.

Question: Name few tags that do not need closing tags.

,
, ,


Question: What is a style sheet?

Answer: It is a file that describes the layout of an HTML document or web page. For example, the color of a text, margins, spacing, fonts, size etc, everything comes under stylesheet. The most common format is CSS (Cascading style sheets).

Question: What is a marquee?

Answer:

It is an HTML element that causes text or image to scroll up, down, left or right automatically. Example, a news flash where text moves horizontally on the screen.

Question: Create a table with 3 rows and 2 columns with a black border.

Answer:

1 2
5 8
11 12
 

Question-Related to C

Question: Who developed C?

Answer: C was originally developed by Dennis M. Ritchie.

Question: Can you write a program to find if a number is prime?

Answer: Check out the answer in this article.

Question: What is a dangling pointer?

Answer: A pointer that points to a free or deleted memory location is called dangling pointer.

Question: Is C platform independent?

Answer: C compiler has to be compiled differently for different OS, hence C is platform dependent.

Question: Explain the different storage classes in C.

Answer: There are 4 storage classes -

  • Auto - the default storage class for variables declared inside a function/block. Cannot be accessed outside the block or function where they are created.
  • Register - the functionality is same as auto, however the compiler stores register variables in the register of the microprocessor for faster access. If no free register is available, memory space is utilized.
  • Static - these are declared only once and the value is retained throughout the scope.
  • External - using the extern keyword of external storage class, allows the same variable to be re-used and re-assigned. If a global variable has been assigned a value, that can be overwritten by using extern for the variable inside another function/block.

Question: Write a simple program to print the average marks of a student.

Answer: int marks[5] = ;

int length = sizeof(marks)/sizeof(int);
double sum = 0;
for(int i=0; i<length; i++)

double average = sum/length;
printf("Average marks = %lf", average);

Read about different data types in C from this nice blog.

Question: What is the difference between struct and union data types?

Answer: In union, the total memory space allocated to the union is the member with the largest size. Space is shared by other members. The union can store only one value at a time. Structs can contain different types of data without compromising on the memory space.

Question: Explain the difference between pass by value and pass by reference using a simple program.

Answer: This detailed blog explains all about pass by value and pass by reference with simple examples.

Question: What are the data structures in C?

Answer: Arrays, stacks, queues, linked lists and trees are the data structures in C. Read more about data structures from this tutorial page.

Question: What are directives? What are ifdef, define and endif?

Answer: Directives tell the compiler to preprocess the code before compilation. These preprocessor directives start with the hash(#) symbol to indicate the same. The most common pre-processor directive is #include that we use in all our programs.

#ifdef and #endif – are conditional compilation directives that help in compilation of certain code if the condition is satisfied. If not, the particular code block will not be compiled.

define - #define directive is used to define a macro in the program. For example,
#define LENGTH 3
LENGTH can then be used anywhere in the program.

Question: What do you mean by the ‘size of’ operator?

Answer: Size of operator returns the size of an operand. The operand can be a data type or an expression. For example, sizeof(int) will return 4, which is the memory allocated to integer data type. Same way sizeof(array)/sizeof(int) will return the length of the elements in an integer array.

Question: Consider a union as

union sample{

int a;
float b;
char c[6];
}u;

In the main function, if you print the size of the union, what will you get?

Answer – We will get the size of the character array as that is the maximum space allotted to the union.

Question: Explain the main concepts of OOPS.

Answer: The main concepts of OOPS are an abstraction, inheritance, encapsulation, and polymorphism. You can give one-liner about each and when asked more, give more details. Watch this video for a quick overview of OOPS concepts.

Question: What is the difference between function overloading and function overriding?

Answer: Overloaded functions have the same name but a different number or type of arguments. For example,

float add(int a, int b);
float add(int a, int b, int c);
float add(float a, int b);

The actual method to be called is decided by the compiler during compile-time based on the parameters that are passed.

In function overriding a base, implementation is overridden by the child class. During run-time, based on the type of object instantiated, the appropriate method (child or parent) is called. For example, if a parent class A and child class B both contain method displayInfo(), and the object is created as A a = new B(); the method of B will be called.

Question: Do you know any design pattern based on the concept of polymorphism?

Answer: Factory pattern is one of the most common patterns that uses polymorphism. You will find this blog very useful in understanding factory pattern in a simple way. You can also get the Head-First Design patterns book to understand all the design patterns (it is a super interesting topic).

Question: What are some of the differences between C and C++?

Answer: This direct link will take you to some important differences.

Question: What is modularity? How is it done in C++?

Answer: A modular program is one which has been split into smaller modules, and each module performs only one task (function) or a set of small functions/tasks. We can implement modularity using OOPS concepts like encapsulation.

Question: Tell the main difference between bubble sort, merge sort and insertion sort.

Answer: The interviewer won’t expect you to tell the whole algorithm. You should just know the concepts and difference.

  • Bubble sort – Simple sorting algorithm where two neighboring elements are compared at a time and swapped if the 1st is larger than 2nd.
  • Merge sort Break the big array into smaller arrays of a single element. Now, sort the arrays while merging them.
  • Insertion sort – There are two arrays. Elements from the unsorted array are taken one by one and inserted into the second array in a sorted manner.

Question: What is a null pointer? How is it different from void pointer?

Answer: Null pointer is used for assigning the value of null or 0 to a pointer variable i.e. a pointer that is not pointing to anything. The variable can be of any data type (int, char, float, long etc…). The void pointer does not associate any data type. It can store the address of a variable of any data type.

Question: What is the use of friend function?

Answer: Friend function of a class can access private and protected members of the class.

If there are two classes say Student and Teacher, and if Student class’s getMarks() function is declared as a friend function in the class Teacher, it can access the private members of the class Teacher.

Question: How is memory allocation done in C++? Is it the same in C?

Answer: Using new() operator. In C, it is done using malloc() and calloc() methods.

Question: What is the difference between ++i and i++ operation?

Answer: If the ++ sign comes before the index, the index is incremented first and then an operation is performed. If the ++ sign is put after the index, the index is incremented after the operation. For example,

int i = 0;
cout << ++i;
cout << i++;

both will print the value as 1.

Question: Explain linked lists and queues.

Answer: Both are data structures in C++.

  • Linked list – In a linked list, each element is linked to the next one using a pointer. The last element on the list points to null. The first element is called a head. Each element contains data and the link to the next element in the list. Watch this video to learn more about linked list.
  • Queue – Queue is a FIFO (first in first out) mechanism. It is similar to our line in ATM counter where the first customer goes in and comes out first. That means, when the queue is full, the oldest element is flushed out first.

Question: What is a pure virtual function?

Answer: Pure virtual function or an abstract function doesn’t have any implementation. We just declare it. The classes that are derived from the abstract class implement the pure virtual function. We can declare pure virtual function by assigning a value of 0 to it.

Question-Related to Java

Question: What is meant by platform dependence?

Answer: In some languages like C, the compilation of code depends on the operating system. That means the code built on one machine can work only on that type of machine and not anywhere else. This is called platform dependence. In languages like Java, the code can be built once and run anywhere irrespective of the OS or machine. That is why Java is platform-independent.

Question: Explain the difference between an interface and an abstract class.

Answer: A class can implement many interfaces (multiple inheritances) but can extend only one abstract class. Interface methods are not implemented. The implementation is up to the application developer. Abstract classes can have a default implementation of common behaviors.

Question: What are JVM and JIT?

Answer: Java code can be executed anywhere because the code is converted from Java bytecodes into the native code of a machine. This is achieved by the JVM (Java Virtual Machine).

A file is compiled only for the first time until it is changed later. If the byte-code is not changed, JVM, the intelligent processor will not waste time compiling such files again. This is called as JIT or Just In Time compilation.

Question: Is there a do-while loop in Java? How is it different from while?

Answer: Yes. In do-while loop, the condition inside while is checked after the statement is executed, hence the statements are executed at least once in the code, whereas in while, the condition is first checked and only if it is true, the statements are executed.

Question: Will this code compile?

byte a = 10;
byte b = 12;
byte result = a + b;
System.out.print(result);

If no, what should you do to make it work?

Answer: The statement will not compile. The result a+b has to be typecasted to byte as the default answer 22 will be an integer. The correct code will be –

byte result = (byte) a + b; or int result = a + b;

Question: What is the expected output of this code?

System.out.print("Hello");
System.out.println("World");

Follow up - What should you change to print both in different lines?

Answer: The answer is HelloWorld. We should use println method to print in a new line.

Consider an array as –

char [] str={'j', 'a', 'v', 'a'};

How would you print the individual characters of the array?

We can use the java.util.Arrays.toString(str) to get the desired result.

Question: What is a NullPointerException?

Answer: If we try to use a null value for any operations, java throws a null pointer exception. For example,

String str = null;
str.compareTo(“java”);

A dot operation will throw NullPointerException.

Question: How is garbage collection done in Java?

Answer: Java easily boasts of the in-built garbage collection done by the JVM. When new() operator is used, the garbage collector allocates memory space. If the object is no longer used, the garbage collector automatically frees up the space used by the object and reuses it for further allocation.

Question: Suppose there are two processes A & B, is there a way that they can send messages to each other?

Answer: Java processes can communicate with each other using threads. Threads enable multi-tasking by completing more than one tasks in parallel without interfering in each other’s data.

Few other questions from database and cloud (for those who know these) –

Question: What is a database schema?

Answer: Schema is a logical view of the entire database structure. It represents the distribution and organization of data and the relations between them through tables, constraints, primary and foreign key constraints and so on.

Question: What are the integrity rules defined in a DBMS?

Answer: There are 2 main types of integrity rules – entity integrity (every table must have a primary key) and referential integrity (foreign key is usually a primary key of some other table and can be null).

Question: Can you write a nested query?

Answer: You can write any nested query that you know. Here is one for example,

SELECT student_id,AVG(marks)
FROM students
GROUP BY student_id
HAVING AVG(marks)>
(SELECT MAX(AVG(min_marks))
FROM marks
WHERE subject IN
(SELECT subject_id FROM subjects
WHERE branch_id
= 'ECE')
GROUP BY subject_id);

that will get the list of students who got marks greater than average marks in all the subjects for the specified department.

Question: What is mutual exclusion?

Answer: Mutual exclusion is a way to prevent deadlock by preventing access to a resource by multiple processes at the same time (concurrently). A thread holds a resource and it is locked. The other threads wait till the resource is released.

Question: What do you know about cloud computing?

Answer: Cloud computing is the availability of resources like data storage and computing requirements on-demand over the internet. The data is centrally located in huge data centres so that it is always available to the end users. All the services, infrastructure, software and platform are available as services stored on a shared computing environment. Some major players are AWS from Amazon, Azure from Microsoft and Google’s cloud platform.

For some of the subjective questions like the last one, you might know more but stick to a short answer unless you are asked for more details by the interviewer.

The questions can be tweaked but this is the overall gist. The questions are tricky and you have to be careful about understanding the questions clearly. The interview will be of average difficulty level and will test your subject knowledge as well as overall attitude towards work. Once you clear technical round, you could be taken to another technical round or an HR round. Some typical HR questions are –

  1. Tell me the most interesting thing about yourself.
  2. General questions about your hobbies and interests.
  3. What do you know about TCS?

For this question, read through TCS website, their recent achievements, their position in the global market and their vision and mission.

  1. Do you like programming? (If you are not from CS background). Why did you choose IT line for career and not your core subject?
  2. What are your strengths and weaknesses?
  3. Can you work in shifts? Will you be able to relocate?
  4. If your manager asks you to do a task you do not like (or is against your ethical principles), but promises you a hike or promotion based on that, will you do it? If yes, why? If no, how would you avoid it?
  5. Do you have any other offers in hand?
  6. If you are the leader of your project, what qualities do you think you should possess?
  7. If the status of your project is red (danger), how would you motivate your team to work more without getting stressed out?

Some of these questions are subjective and there is no right or wrong answer as long as you have a justification for the same. These will be a test of your patience, handling stress and tough situations at work.

Final word

You will find loads of overwhelming information on the internet. Different candidates have different experiences and they share it on the net. But the key is to be well-prepared with what you have written in your resume and to accept if you do not know any of the answers. There is no shortcut to clearing TCS interview. If you don’t know one answer, don’t get nervous or confused, the interviewers judge you on overall performance and not just one or two questions. Be honest, be confident and most importantly, be cool, so that you can remember the answers you have prepared.

Check out this coding interview course and brush yourself up for TCS Interviews: Intro to Dynamic Programming.

For generic interview questions, follow this amazing book with top programming questions and answers: Cracking the Coding Interview: 189 Programming Questions and Solutions.

All the best!

People are also reading:

By Ramya Shankar

A cheerful, full of life and vibrant person, I hold a lot of dreams that I want to fulfill on my own. My passion for writing started with small diary entries and travel blogs, after which I have moved on to writing well-researched technical content. I find it fascinating to blend thoughts and research and shape them into something beautiful through my writing.

View all post by the author

Subscribe to our Newsletter for Articles, News, & Jobs.

I accept the Terms and Conditions.
Thanks for subscribing! Look out for our welcome email to verify your email and get our free newsletters.

Disclosure: Hackr.io is supported by its audience. When you purchase through links on our site, we may earn an affiliate commission.

In this article

Learn More

Please login to leave comments